package com.onemore.task;

import java.io.File;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.voovan.db.CallType;
import org.voovan.db.JdbcOperate;
import org.voovan.http.server.HttpRequest;
import org.voovan.http.server.HttpResponse;
import org.voovan.test.db.ScriptEntity;
import org.voovan.tools.TFile;
import org.voovan.tools.TProperties;
import org.voovan.tools.log.Logger;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceFactory;
import com.alibaba.fastjson.JSONObject;
import com.onemore.task.model.ModelJorder;
import com.onemore.task.model.ModelJordermx;
import com.onemore.task.model.ModelJsend;
import com.onemore.task.model.ModelJsendmx;
import com.onemore.task.model.ModelMtab;
import com.onemore.task.model.ModelShangpin;
import com.onemore.task.model.ModelSpgg1;
import com.onemore.task.model.ModelSpgg2;
import com.onemore.task.model.ModelSpjhd;
import com.onemore.task.model.ModelSpjhdmx;
import com.onemore.task.model.ModelSpthd;
import com.onemore.task.model.ModelSpthdmx;
import com.onemore.task.model.ModelTest;
import com.onemore.task.model.ModelVendor;
import com.sun.tools.internal.ws.processor.model.Model;

/**
 * 业务数据库基类
 * @author zzj
 *
 * Licence: Apache v2 License
 */
public class OneJdbc extends JdbcGlobal{
	/**
	 * 获取插入表是否存在
	 * @return
	 * @throws SQLException
	 */
    static public List<Map<String, Object>> getMtab() throws SQLException
    {
		return ModelMtab.getMtab();
    }
    /**
     * 插入商品进货通知单主表 主键：DJBH
     * @param json
     * @return
     * @throws SQLException 
     */
    static public boolean insert_jorder(JSONObject json) throws SQLException
    {
		return ModelJorder.insert_jorder(json);
    }
    

    /**
     * 插入商品进货通知单主表 主键：MXBH
     * @param json
     * @return
     * @throws SQLException 
     */
    static public boolean insert_jordermx(JSONObject json) throws SQLException
    {
    	return ModelJordermx.insert(json);
    }
    

    /**
     * 插入商品进货通知单主表 主键：DJBH
     * @param json
     * @return
     * @throws SQLException 
     */
    static public boolean insert_jsend(JSONObject json) throws SQLException
    {
		return ModelJsend.insert(json);
    }

    /**
     * 插入商品进货通知单主表 主键：MXBH
     * @param json
     * @return
     * @throws SQLException 
     */
    static public boolean insert_jsendmx(JSONObject json) throws SQLException
    {
    	return ModelJsendmx.insert(json);
    }
    /**
     * 测试
     * @param json
     * @return
     * @throws SQLException 
     */
    static public boolean insert_test(JSONObject json) throws SQLException
    {
    	return ModelTest.insert_test(json);
    }

    /**
     * 插入供应商 主键GHSDM
     * @param json
     * @return
     * @throws SQLException 
     */
    static public boolean insert_vendor(JSONObject json) throws SQLException
    {
		return ModelVendor.insert(json);
    }

    /**
     * 插入商品
     * @param json
     * @return
     * @throws SQLException 
     */
    static public boolean insert_goods(JSONObject json) throws SQLException
    {
    	return ModelShangpin.insert_goods(json);
    }
    /**
     * 查找规格代码
     * @param json
     * @return
     * @throws SQLException 
     */
    static public boolean seach_guige1(String ggdm) throws SQLException
    {
		return ModelSpgg1.seach_guige1(ggdm);
    }
    /**
     * 查找规格代码
     * @param json
     * @return
     * @throws SQLException 
     */
    static public boolean seach_guige2(String ggdm) throws SQLException
    {
		return ModelSpgg2.seach_guige2(ggdm);
    }
    /**
     * 插入商品与商品规格1关联表（颜色）主键SPDM+GGDM
     * @param json
     * @return
     * @throws SQLException 
     */
    static public boolean insert_spgg1(JSONObject json) throws SQLException
    {
    	return ModelSpgg1.insert_spgg1(json);
    }

    /**
     * 插入商品与商品规格2关联表(尺码)    主键SPDM+GGDM
     * @param json
     * @return
     * @throws SQLException 
     */
    static public boolean insert_spgg2(JSONObject json) throws SQLException
    {
    	return ModelSpgg2.insert_spgg2(json);
    }
    /**
     * 
     * @param stamp
     * @return
     * @throws SQLException
     */
    static public boolean deleteMtab(String stamp) throws SQLException
    {
    	return ModelMtab.deleteMtab(stamp);
    }
	/**
	 * 从数据库获取进货单数据
	 * @param DJBH
	 * @return
	 * @throws SQLException
	 */
    static public List<Map<String, Object>> getSpjhd(String DJBH) throws SQLException
    {
    	return ModelSpjhd.getList(DJBH);
    }
	
    /**
     * 获取进货单明细表数据
     * @param DJBH
     * @return
     * @throws SQLException
     */
    static public List<Map<String, Object>> getSpjhdmx(String DJBH) throws SQLException
    {
		return ModelSpjhdmx.getList(DJBH);
    }
	
	/**
	 * 从数据库获取退货单数据
	 * @param DJBH
	 * @return
	 * @throws SQLException
	 */
    static public List<Map<String, Object>> getSpthd(String DJBH) throws SQLException
    {
		return ModelSpthd.getList(DJBH);
    }
    
    /**
     * 获取退货单明细表数据
     * @param DJBH
     * @return
     * @throws SQLException
     */
    static public List<Map<String, Object>> getSpthdmx(String DJBH) throws SQLException
    {
		return ModelSpthdmx.getList(DJBH);
    }
}
